
#import "RNPhotobrowser.h"
#import <GKPhotoBrowser.h>
@implementation RNPhotobrowser

- (dispatch_queue_t)methodQueue
{
    return dispatch_get_main_queue();
}
RCT_EXPORT_MODULE()
RCT_EXPORT_METHOD(browserPhotos:(NSArray*)urls index:(int)index){
  NSMutableArray *photos = [NSMutableArray new];
  [urls enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  GKPhoto *photo = [GKPhoto new];
  photo.url = [NSURL URLWithString:obj];
  [photos addObject:photo];
  }];
  GKPhotoBrowser *browser = [GKPhotoBrowser photoBrowserWithPhotos:photos currentIndex:index];
  browser.showStyle = GKPhotoBrowserShowStyleNone;
  UIViewController* vc = [UIApplication sharedApplication].keyWindow.rootViewController;
  [browser showFromVC:vc];
}

@end
